﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Perceiveit.Xml.Converters
{

    #region public class HTMLColorXConverter : XConverter<System.Drawing.Color>

    public class HTMLColorXConverter : XConverter<System.Drawing.Color>
    {
        public override string ToString(System.Drawing.Color color)
        {
            if (color == System.Drawing.Color.Transparent)
                return string.Empty;
            else
                return System.Drawing.ColorTranslator.ToHtml(color);
        }

        public override System.Drawing.Color FromString(string value)
        {
            if (string.IsNullOrEmpty(value))
                return System.Drawing.Color.Transparent;
            return System.Drawing.ColorTranslator.FromHtml(value);
        }
    }

    #endregion

}
